//
//  SearchFormViewController.h
//  BVCMS Search
//
//  Created by Allen Thomas on 9/13/10.
//

#import <UIKit/UIKit.h>
//#import "SearchResultsViewController.h"
#import "HttpConnectionHandler.h";

#define kTotalRows 3
#define kNameRowIndex 0
#define kCommunicationRowIndex 1
#define kAddressRowIndex 2

@interface SearchFormViewController : UIViewController <UITableViewDelegate, UITableViewDataSource, UITextFieldDelegate> {
	UITextField *textFieldBeingEdited;
	
	UITextField *nameField;
	UITextField *commField;
	UITextField *addrField;
	
	NSMutableArray *people;
	int numberOfResults;
	
	IBOutlet UIButton *searchButton;
	IBOutlet UIButton *clearButton;

	IBOutlet UITableView *table;
	
	UIReturnKeyType returnKeyType;
	NSString *populateName;
	NSString *firstTitle;
	NSString *secondTitle;
	NSString *thirdTitle;
	NSString *firstPlaceholder;
	NSString *secondPlaceholder;
	NSString *thirdPlaceholder;
	
	UIView *loadingView;
}

@property (nonatomic, retain) NSString *populateName;
@property (nonatomic, retain) NSMutableArray *people;
@property (nonatomic) int numberOfResults;

@property (nonatomic, retain) UIButton *searchButton;
@property (nonatomic, retain) UIButton *clearButton;

@property (nonatomic, retain) UITableView *table;

-(IBAction)clear:(id)sender;

-(IBAction)search:(id)sender;
-(void) search_callback:(NSData *)data;
-(void) search_error_callback:(NSError *)error;

-(void) parseXml:(NSData *)data;
-(void) handleElement_People: (NSDictionary*) attributes;  
-(void) handleElement_Person: (NSDictionary*) attributes;  

-(IBAction)backgroundTap:(id)sender;
-(IBAction)textFieldDone:(id)sender;

-(NSString*)getText:(UITextField*)textField;


@end
